--
-- PostgreSQL database dump
--

-- Dumped from database version 9.0.1
-- Dumped by pg_dump version 9.0.1
-- Started on 2011-04-05 15:37:41 CEST

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

--
-- TOC entry 358 (class 2612 OID 11574)
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres
--

CREATE OR REPLACE PROCEDURAL LANGUAGE plpgsql;


ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO postgres;

SET search_path = public, pg_catalog;

--
-- TOC entry 1550 (class 1259 OID 17661)
-- Dependencies: 6
-- Name: id_carte_seq; Type: SEQUENCE; Schema: public; Owner: baradmin
--

CREATE SEQUENCE id_carte_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.id_carte_seq OWNER TO baradmin;

--
-- TOC entry 1950 (class 0 OID 0)
-- Dependencies: 1550
-- Name: id_carte_seq; Type: SEQUENCE SET; Schema: public; Owner: baradmin
--

SELECT pg_catalog.setval('id_carte_seq', 1, false);


SET default_tablespace = '';

SET default_with_oids = false;

--
-- TOC entry 1551 (class 1259 OID 17663)
-- Dependencies: 1854 1855 6
-- Name: cb_carte; Type: TABLE; Schema: public; Owner: baradmin; Tablespace: 
--

CREATE TABLE cb_carte (
    id_carte integer DEFAULT nextval('id_carte_seq'::regclass) NOT NULL,
    actif boolean DEFAULT true NOT NULL
);


ALTER TABLE public.cb_carte OWNER TO baradmin;

--
-- TOC entry 1552 (class 1259 OID 17668)
-- Dependencies: 6
-- Name: id_groupe_seq; Type: SEQUENCE; Schema: public; Owner: baradmin
--

CREATE SEQUENCE id_groupe_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.id_groupe_seq OWNER TO baradmin;

--
-- TOC entry 1951 (class 0 OID 0)
-- Dependencies: 1552
-- Name: id_groupe_seq; Type: SEQUENCE SET; Schema: public; Owner: baradmin
--

SELECT pg_catalog.setval('id_groupe_seq', 1, false);


--
-- TOC entry 1553 (class 1259 OID 17670)
-- Dependencies: 1856 1857 6
-- Name: cb_groupes; Type: TABLE; Schema: public; Owner: baradmin; Tablespace: 
--

CREATE TABLE cb_groupes (
    id_groupe integer DEFAULT nextval('id_groupe_seq'::regclass) NOT NULL,
    nom text DEFAULT 'groupe sans nom'::text NOT NULL,
    code text,
    bs1 integer,
    bs2 integer,
    bs3 integer,
    bs_auto boolean
);


ALTER TABLE public.cb_groupes OWNER TO baradmin;

--
-- TOC entry 1554 (class 1259 OID 17678)
-- Dependencies: 6
-- Name: id_action_carte_seq; Type: SEQUENCE; Schema: public; Owner: baradmin
--

CREATE SEQUENCE id_action_carte_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.id_action_carte_seq OWNER TO baradmin;

--
-- TOC entry 1952 (class 0 OID 0)
-- Dependencies: 1554
-- Name: id_action_carte_seq; Type: SEQUENCE SET; Schema: public; Owner: baradmin
--

SELECT pg_catalog.setval('id_action_carte_seq', 1, false);


--
-- TOC entry 1555 (class 1259 OID 17680)
-- Dependencies: 1858 1859 6
-- Name: cb_historique_carte; Type: TABLE; Schema: public; Owner: baradmin; Tablespace: 
--

CREATE TABLE cb_historique_carte (
    id_action_carte integer DEFAULT nextval('id_action_carte_seq'::regclass) NOT NULL,
    login text NOT NULL,
    montant double precision NOT NULL,
    date timestamp without time zone DEFAULT now() NOT NULL,
    commentaire text
);


ALTER TABLE public.cb_historique_carte OWNER TO baradmin;

--
-- TOC entry 1556 (class 1259 OID 17688)
-- Dependencies: 6
-- Name: id_action_seq; Type: SEQUENCE; Schema: public; Owner: baradmin
--

CREATE SEQUENCE id_action_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.id_action_seq OWNER TO baradmin;

--
-- TOC entry 1953 (class 0 OID 0)
-- Dependencies: 1556
-- Name: id_action_seq; Type: SEQUENCE SET; Schema: public; Owner: baradmin
--

SELECT pg_catalog.setval('id_action_seq', 1, false);


--
-- TOC entry 1557 (class 1259 OID 17690)
-- Dependencies: 1860 1861 6
-- Name: cb_historique_system; Type: TABLE; Schema: public; Owner: baradmin; Tablespace: 
--

CREATE TABLE cb_historique_system (
    id_action integer DEFAULT nextval('id_action_seq'::regclass) NOT NULL,
    "time" timestamp without time zone DEFAULT now() NOT NULL,
    libelle text NOT NULL,
    login text NOT NULL,
    id_groupe integer NOT NULL
);


ALTER TABLE public.cb_historique_system OWNER TO baradmin;

--
-- TOC entry 1558 (class 1259 OID 17698)
-- Dependencies: 6
-- Name: id_action_vente_seq; Type: SEQUENCE; Schema: public; Owner: baradmin
--

CREATE SEQUENCE id_action_vente_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.id_action_vente_seq OWNER TO baradmin;

--
-- TOC entry 1954 (class 0 OID 0)
-- Dependencies: 1558
-- Name: id_action_vente_seq; Type: SEQUENCE SET; Schema: public; Owner: baradmin
--

SELECT pg_catalog.setval('id_action_vente_seq', 1, false);


--
-- TOC entry 1559 (class 1259 OID 17700)
-- Dependencies: 1862 1863 1864 1865 6
-- Name: cb_historique_vente; Type: TABLE; Schema: public; Owner: baradmin; Tablespace: 
--

CREATE TABLE cb_historique_vente (
    id_action integer DEFAULT nextval('id_action_vente_seq'::regclass) NOT NULL,
    id_groupe integer NOT NULL,
    login_vendeur text NOT NULL,
    login_client text NOT NULL,
    montant double precision DEFAULT 0,
    id_produit integer NOT NULL,
    stock integer DEFAULT 0,
    date timestamp without time zone DEFAULT now() NOT NULL,
    libelle text NOT NULL
);


ALTER TABLE public.cb_historique_vente OWNER TO baradmin;

--
-- TOC entry 1560 (class 1259 OID 17710)
-- Dependencies: 6
-- Name: id_perm_seq; Type: SEQUENCE; Schema: public; Owner: baradmin
--

CREATE SEQUENCE id_perm_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.id_perm_seq OWNER TO baradmin;

--
-- TOC entry 1955 (class 0 OID 0)
-- Dependencies: 1560
-- Name: id_perm_seq; Type: SEQUENCE SET; Schema: public; Owner: baradmin
--

SELECT pg_catalog.setval('id_perm_seq', 6, true);


--
-- TOC entry 1561 (class 1259 OID 17712)
-- Dependencies: 1866 1867 6
-- Name: cb_permissions; Type: TABLE; Schema: public; Owner: baradmin; Tablespace: 
--

CREATE TABLE cb_permissions (
    id_perm integer DEFAULT nextval('id_perm_seq'::regclass) NOT NULL,
    nom text DEFAULT 'permission sans nom'::text NOT NULL
);


ALTER TABLE public.cb_permissions OWNER TO baradmin;

--
-- TOC entry 1562 (class 1259 OID 17720)
-- Dependencies: 1868 6
-- Name: cb_prix; Type: TABLE; Schema: public; Owner: baradmin; Tablespace: 
--

CREATE TABLE cb_prix (
    id_produit integer NOT NULL,
    id_type_prix integer NOT NULL,
    prix double precision DEFAULT 0 NOT NULL
);


ALTER TABLE public.cb_prix OWNER TO baradmin;

--
-- TOC entry 1563 (class 1259 OID 17724)
-- Dependencies: 6
-- Name: id_produit_seq; Type: SEQUENCE; Schema: public; Owner: baradmin
--

CREATE SEQUENCE id_produit_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.id_produit_seq OWNER TO baradmin;

--
-- TOC entry 1956 (class 0 OID 0)
-- Dependencies: 1563
-- Name: id_produit_seq; Type: SEQUENCE SET; Schema: public; Owner: baradmin
--

SELECT pg_catalog.setval('id_produit_seq', 1, false);


--
-- TOC entry 1564 (class 1259 OID 17726)
-- Dependencies: 1869 1870 1871 6
-- Name: cb_produit; Type: TABLE; Schema: public; Owner: baradmin; Tablespace: 
--

CREATE TABLE cb_produit (
    id_produit integer DEFAULT nextval('id_produit_seq'::regclass) NOT NULL,
    nom text DEFAULT 'produit sans nom'::text NOT NULL,
    id_groupe integer NOT NULL,
    quantite integer DEFAULT 0 NOT NULL,
    id_type integer,
    code_barres text
);


ALTER TABLE public.cb_produit OWNER TO baradmin;

--
-- TOC entry 1565 (class 1259 OID 17735)
-- Dependencies: 6
-- Name: cb_role_perm; Type: TABLE; Schema: public; Owner: baradmin; Tablespace: 
--

CREATE TABLE cb_role_perm (
    id_role integer NOT NULL,
    id_perm integer NOT NULL
);


ALTER TABLE public.cb_role_perm OWNER TO baradmin;

--
-- TOC entry 1566 (class 1259 OID 17738)
-- Dependencies: 6
-- Name: id_role_seq; Type: SEQUENCE; Schema: public; Owner: baradmin
--

CREATE SEQUENCE id_role_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.id_role_seq OWNER TO baradmin;

--
-- TOC entry 1957 (class 0 OID 0)
-- Dependencies: 1566
-- Name: id_role_seq; Type: SEQUENCE SET; Schema: public; Owner: baradmin
--

SELECT pg_catalog.setval('id_role_seq', 2, true);


--
-- TOC entry 1567 (class 1259 OID 17740)
-- Dependencies: 1872 1873 6
-- Name: cb_roles; Type: TABLE; Schema: public; Owner: baradmin; Tablespace: 
--

CREATE TABLE cb_roles (
    id_role integer DEFAULT nextval('id_role_seq'::regclass) NOT NULL,
    nom text DEFAULT 'rôle sans nom'::text NOT NULL
);


ALTER TABLE public.cb_roles OWNER TO baradmin;

--
-- TOC entry 1568 (class 1259 OID 17748)
-- Dependencies: 6
-- Name: cb_roles_users; Type: TABLE; Schema: public; Owner: baradmin; Tablespace: 
--

CREATE TABLE cb_roles_users (
    id_role integer NOT NULL,
    login text NOT NULL,
    id_groupe integer NOT NULL
);


ALTER TABLE public.cb_roles_users OWNER TO baradmin;

--
-- TOC entry 1569 (class 1259 OID 17754)
-- Dependencies: 6
-- Name: cb_stock_argent; Type: TABLE; Schema: public; Owner: baradmin; Tablespace: 
--

CREATE TABLE cb_stock_argent (
    id_stock integer NOT NULL,
    id_argent integer NOT NULL
);


ALTER TABLE public.cb_stock_argent OWNER TO baradmin;

--
-- TOC entry 1570 (class 1259 OID 17757)
-- Dependencies: 6
-- Name: id_type_prix_seq; Type: SEQUENCE; Schema: public; Owner: baradmin
--

CREATE SEQUENCE id_type_prix_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.id_type_prix_seq OWNER TO baradmin;

--
-- TOC entry 1958 (class 0 OID 0)
-- Dependencies: 1570
-- Name: id_type_prix_seq; Type: SEQUENCE SET; Schema: public; Owner: baradmin
--

SELECT pg_catalog.setval('id_type_prix_seq', 3, true);


--
-- TOC entry 1571 (class 1259 OID 17759)
-- Dependencies: 1874 1875 6
-- Name: cb_type_prix; Type: TABLE; Schema: public; Owner: baradmin; Tablespace: 
--

CREATE TABLE cb_type_prix (
    id_type_prix integer DEFAULT nextval('id_type_prix_seq'::regclass) NOT NULL,
    nom text DEFAULT 'produit sans nom'::text NOT NULL
);


ALTER TABLE public.cb_type_prix OWNER TO baradmin;

--
-- TOC entry 1572 (class 1259 OID 17767)
-- Dependencies: 6
-- Name: id_type_seq; Type: SEQUENCE; Schema: public; Owner: baradmin
--

CREATE SEQUENCE id_type_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.id_type_seq OWNER TO baradmin;

--
-- TOC entry 1959 (class 0 OID 0)
-- Dependencies: 1572
-- Name: id_type_seq; Type: SEQUENCE SET; Schema: public; Owner: baradmin
--

SELECT pg_catalog.setval('id_type_seq', 1, false);


--
-- TOC entry 1573 (class 1259 OID 17769)
-- Dependencies: 1876 6
-- Name: cb_type_produit; Type: TABLE; Schema: public; Owner: baradmin; Tablespace: 
--

CREATE TABLE cb_type_produit (
    nom_type text NOT NULL,
    id_type integer DEFAULT nextval('id_type_seq'::regclass) NOT NULL
);


ALTER TABLE public.cb_type_produit OWNER TO baradmin;

--
-- TOC entry 1574 (class 1259 OID 17776)
-- Dependencies: 1877 1878 6
-- Name: cb_users; Type: TABLE; Schema: public; Owner: baradmin; Tablespace: 
--

CREATE TABLE cb_users (
    login text NOT NULL,
    id_carte integer DEFAULT nextval('id_carte_seq'::regclass) NOT NULL,
    solde double precision DEFAULT 0 NOT NULL,
    promo text NOT NULL,
    nom text NOT NULL,
    prenom text NOT NULL,
    mdp text
);


ALTER TABLE public.cb_users OWNER TO baradmin;

--
-- TOC entry 1575 (class 1259 OID 17784)
-- Dependencies: 6
-- Name: id_argent_seq; Type: SEQUENCE; Schema: public; Owner: baradmin
--

CREATE SEQUENCE id_argent_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.id_argent_seq OWNER TO baradmin;

--
-- TOC entry 1960 (class 0 OID 0)
-- Dependencies: 1575
-- Name: id_argent_seq; Type: SEQUENCE SET; Schema: public; Owner: baradmin
--

SELECT pg_catalog.setval('id_argent_seq', 1, false);


--
-- TOC entry 1576 (class 1259 OID 17786)
-- Dependencies: 6
-- Name: id_stock_seq; Type: SEQUENCE; Schema: public; Owner: baradmin
--

CREATE SEQUENCE id_stock_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.id_stock_seq OWNER TO baradmin;

--
-- TOC entry 1961 (class 0 OID 0)
-- Dependencies: 1576
-- Name: id_stock_seq; Type: SEQUENCE SET; Schema: public; Owner: baradmin
--

SELECT pg_catalog.setval('id_stock_seq', 1, false);


--
-- TOC entry 1930 (class 0 OID 17663)
-- Dependencies: 1551
-- Data for Name: cb_carte; Type: TABLE DATA; Schema: public; Owner: baradmin
--

COPY cb_carte (id_carte, actif) FROM stdin;
-1	f
0	f
\.


--
-- TOC entry 1931 (class 0 OID 17670)
-- Dependencies: 1553
-- Data for Name: cb_groupes; Type: TABLE DATA; Schema: public; Owner: baradmin
--

COPY cb_groupes (id_groupe, nom, code, bs1, bs2, bs3, bs_auto) FROM stdin;
1	administration	\N	\N	\N	\N	\N
\.


--
-- TOC entry 1932 (class 0 OID 17680)
-- Dependencies: 1555
-- Data for Name: cb_historique_carte; Type: TABLE DATA; Schema: public; Owner: baradmin
--

COPY cb_historique_carte (id_action_carte, login, montant, date, commentaire) FROM stdin;
\.


--
-- TOC entry 1933 (class 0 OID 17690)
-- Dependencies: 1557
-- Data for Name: cb_historique_system; Type: TABLE DATA; Schema: public; Owner: baradmin
--

COPY cb_historique_system (id_action, "time", libelle, login, id_groupe) FROM stdin;
\.


--
-- TOC entry 1934 (class 0 OID 17700)
-- Dependencies: 1559
-- Data for Name: cb_historique_vente; Type: TABLE DATA; Schema: public; Owner: baradmin
--

COPY cb_historique_vente (id_action, id_groupe, login_vendeur, login_client, montant, id_produit, stock, date, libelle) FROM stdin;
\.


--
-- TOC entry 1935 (class 0 OID 17712)
-- Dependencies: 1561
-- Data for Name: cb_permissions; Type: TABLE DATA; Schema: public; Owner: baradmin
--

COPY cb_permissions (id_perm, nom) FROM stdin;
1	Vente
2	Historique
3	GestionCarte
4	PrixProduit
5	GestionGroupe
6	GestionPerso
\.


--
-- TOC entry 1936 (class 0 OID 17720)
-- Dependencies: 1562
-- Data for Name: cb_prix; Type: TABLE DATA; Schema: public; Owner: baradmin
--

COPY cb_prix (id_produit, id_type_prix, prix) FROM stdin;
\.


--
-- TOC entry 1937 (class 0 OID 17726)
-- Dependencies: 1564
-- Data for Name: cb_produit; Type: TABLE DATA; Schema: public; Owner: baradmin
--

COPY cb_produit (id_produit, nom, id_groupe, quantite, id_type, code_barres) FROM stdin;
\.


--
-- TOC entry 1938 (class 0 OID 17735)
-- Dependencies: 1565
-- Data for Name: cb_role_perm; Type: TABLE DATA; Schema: public; Owner: baradmin
--

COPY cb_role_perm (id_role, id_perm) FROM stdin;
1	1
1	3
1	6
2	1
2	2
2	3
2	4
2	5
2	6
\.


--
-- TOC entry 1939 (class 0 OID 17740)
-- Dependencies: 1567
-- Data for Name: cb_roles; Type: TABLE DATA; Schema: public; Owner: baradmin
--

COPY cb_roles (id_role, nom) FROM stdin;
1	Vendeur
2	AdminGroupe
\.


--
-- TOC entry 1940 (class 0 OID 17748)
-- Dependencies: 1568
-- Data for Name: cb_roles_users; Type: TABLE DATA; Schema: public; Owner: baradmin
--

COPY cb_roles_users (id_role, login, id_groupe) FROM stdin;
\.


--
-- TOC entry 1941 (class 0 OID 17754)
-- Dependencies: 1569
-- Data for Name: cb_stock_argent; Type: TABLE DATA; Schema: public; Owner: baradmin
--

COPY cb_stock_argent (id_stock, id_argent) FROM stdin;
\.


--
-- TOC entry 1942 (class 0 OID 17759)
-- Dependencies: 1571
-- Data for Name: cb_type_prix; Type: TABLE DATA; Schema: public; Owner: baradmin
--

COPY cb_type_prix (id_type_prix, nom) FROM stdin;
1	CB
2	Espèce
3	Spécial
\.


--
-- TOC entry 1943 (class 0 OID 17769)
-- Dependencies: 1573
-- Data for Name: cb_type_produit; Type: TABLE DATA; Schema: public; Owner: baradmin
--

COPY cb_type_produit (nom_type, id_type) FROM stdin;
\.


--
-- TOC entry 1944 (class 0 OID 17776)
-- Dependencies: 1574
-- Data for Name: cb_users; Type: TABLE DATA; Schema: public; Owner: baradmin
--

COPY cb_users (login, id_carte, solde, promo, nom, prenom, mdp) FROM stdin;
baradmin	-1	0	admin	Admin	Bar	\N
vente_espèce	0	0	admin	Espèce	Vente	\N
\.


--
-- TOC entry 1892 (class 2606 OID 17789)
-- Dependencies: 1562 1562 1562
-- Name: cb_prix_primary_key; Type: CONSTRAINT; Schema: public; Owner: baradmin; Tablespace: 
--

ALTER TABLE ONLY cb_prix
    ADD CONSTRAINT cb_prix_primary_key PRIMARY KEY (id_produit, id_type_prix);


--
-- TOC entry 1909 (class 2606 OID 17791)
-- Dependencies: 1574 1574
-- Name: cb_users_pkey; Type: CONSTRAINT; Schema: public; Owner: baradmin; Tablespace: 
--

ALTER TABLE ONLY cb_users
    ADD CONSTRAINT cb_users_pkey PRIMARY KEY (login);


--
-- TOC entry 1884 (class 2606 OID 17793)
-- Dependencies: 1555 1555
-- Name: id_action_carte_primary_key; Type: CONSTRAINT; Schema: public; Owner: baradmin; Tablespace: 
--

ALTER TABLE ONLY cb_historique_carte
    ADD CONSTRAINT id_action_carte_primary_key PRIMARY KEY (id_action_carte);


--
-- TOC entry 1886 (class 2606 OID 17795)
-- Dependencies: 1557 1557
-- Name: id_action_primary_key; Type: CONSTRAINT; Schema: public; Owner: baradmin; Tablespace: 
--

ALTER TABLE ONLY cb_historique_system
    ADD CONSTRAINT id_action_primary_key PRIMARY KEY (id_action);


--
-- TOC entry 1888 (class 2606 OID 17797)
-- Dependencies: 1559 1559
-- Name: id_action_vente_primary_key; Type: CONSTRAINT; Schema: public; Owner: baradmin; Tablespace: 
--

ALTER TABLE ONLY cb_historique_vente
    ADD CONSTRAINT id_action_vente_primary_key PRIMARY KEY (id_action);


--
-- TOC entry 1880 (class 2606 OID 17799)
-- Dependencies: 1551 1551
-- Name: id_carte; Type: CONSTRAINT; Schema: public; Owner: baradmin; Tablespace: 
--

ALTER TABLE ONLY cb_carte
    ADD CONSTRAINT id_carte PRIMARY KEY (id_carte);


--
-- TOC entry 1899 (class 2606 OID 17801)
-- Dependencies: 1567 1567
-- Name: id_carte_primary_key; Type: CONSTRAINT; Schema: public; Owner: baradmin; Tablespace: 
--

ALTER TABLE ONLY cb_roles
    ADD CONSTRAINT id_carte_primary_key PRIMARY KEY (id_role);


--
-- TOC entry 1911 (class 2606 OID 17803)
-- Dependencies: 1574 1574
-- Name: id_carte_unique; Type: CONSTRAINT; Schema: public; Owner: baradmin; Tablespace: 
--

ALTER TABLE ONLY cb_users
    ADD CONSTRAINT id_carte_unique UNIQUE (id_carte);


--
-- TOC entry 1882 (class 2606 OID 17805)
-- Dependencies: 1553 1553
-- Name: id_groupe_primary_key; Type: CONSTRAINT; Schema: public; Owner: baradmin; Tablespace: 
--

ALTER TABLE ONLY cb_groupes
    ADD CONSTRAINT id_groupe_primary_key PRIMARY KEY (id_groupe);


--
-- TOC entry 1890 (class 2606 OID 17807)
-- Dependencies: 1561 1561
-- Name: id_perm_primary_key; Type: CONSTRAINT; Schema: public; Owner: baradmin; Tablespace: 
--

ALTER TABLE ONLY cb_permissions
    ADD CONSTRAINT id_perm_primary_key PRIMARY KEY (id_perm);


--
-- TOC entry 1895 (class 2606 OID 17809)
-- Dependencies: 1564 1564
-- Name: id_produit_primary_key; Type: CONSTRAINT; Schema: public; Owner: baradmin; Tablespace: 
--

ALTER TABLE ONLY cb_produit
    ADD CONSTRAINT id_produit_primary_key PRIMARY KEY (id_produit);


--
-- TOC entry 1907 (class 2606 OID 17811)
-- Dependencies: 1573 1573
-- Name: id_type_primary_key; Type: CONSTRAINT; Schema: public; Owner: baradmin; Tablespace: 
--

ALTER TABLE ONLY cb_type_produit
    ADD CONSTRAINT id_type_primary_key PRIMARY KEY (id_type);


--
-- TOC entry 1905 (class 2606 OID 17813)
-- Dependencies: 1571 1571
-- Name: id_type_prix_primary_key; Type: CONSTRAINT; Schema: public; Owner: baradmin; Tablespace: 
--

ALTER TABLE ONLY cb_type_prix
    ADD CONSTRAINT id_type_prix_primary_key PRIMARY KEY (id_type_prix);


--
-- TOC entry 1913 (class 2606 OID 17815)
-- Dependencies: 1574 1574
-- Name: login_unique; Type: CONSTRAINT; Schema: public; Owner: baradmin; Tablespace: 
--

ALTER TABLE ONLY cb_users
    ADD CONSTRAINT login_unique UNIQUE (login);


--
-- TOC entry 1897 (class 2606 OID 17817)
-- Dependencies: 1565 1565 1565
-- Name: primary_key; Type: CONSTRAINT; Schema: public; Owner: baradmin; Tablespace: 
--

ALTER TABLE ONLY cb_role_perm
    ADD CONSTRAINT primary_key PRIMARY KEY (id_role, id_perm);


--
-- TOC entry 1901 (class 2606 OID 17819)
-- Dependencies: 1568 1568 1568 1568
-- Name: roles_users_primary_key; Type: CONSTRAINT; Schema: public; Owner: baradmin; Tablespace: 
--

ALTER TABLE ONLY cb_roles_users
    ADD CONSTRAINT roles_users_primary_key PRIMARY KEY (id_role, login, id_groupe);


--
-- TOC entry 1903 (class 2606 OID 17821)
-- Dependencies: 1569 1569 1569
-- Name: stock_argent_primary_key; Type: CONSTRAINT; Schema: public; Owner: baradmin; Tablespace: 
--

ALTER TABLE ONLY cb_stock_argent
    ADD CONSTRAINT stock_argent_primary_key PRIMARY KEY (id_stock, id_argent);


--
-- TOC entry 1893 (class 1259 OID 17822)
-- Dependencies: 1564
-- Name: fki_id_type_foreign_key; Type: INDEX; Schema: public; Owner: baradmin; Tablespace: 
--

CREATE INDEX fki_id_type_foreign_key ON cb_produit USING btree (id_type);


--
-- TOC entry 1929 (class 2606 OID 17823)
-- Dependencies: 1574 1879 1551
-- Name: id_carte_foreign_key; Type: FK CONSTRAINT; Schema: public; Owner: baradmin
--

ALTER TABLE ONLY cb_users
    ADD CONSTRAINT id_carte_foreign_key FOREIGN KEY (id_carte) REFERENCES cb_carte(id_carte);


--
-- TOC entry 1922 (class 2606 OID 17828)
-- Dependencies: 1881 1553 1564
-- Name: id_groupe; Type: FK CONSTRAINT; Schema: public; Owner: baradmin
--

ALTER TABLE ONLY cb_produit
    ADD CONSTRAINT id_groupe FOREIGN KEY (id_groupe) REFERENCES cb_groupes(id_groupe);


--
-- TOC entry 1926 (class 2606 OID 17833)
-- Dependencies: 1881 1568 1553
-- Name: id_groupe_foreign_key; Type: FK CONSTRAINT; Schema: public; Owner: baradmin
--

ALTER TABLE ONLY cb_roles_users
    ADD CONSTRAINT id_groupe_foreign_key FOREIGN KEY (id_groupe) REFERENCES cb_groupes(id_groupe);


--
-- TOC entry 1915 (class 2606 OID 17838)
-- Dependencies: 1881 1553 1557
-- Name: id_groupe_foreign_key; Type: FK CONSTRAINT; Schema: public; Owner: baradmin
--

ALTER TABLE ONLY cb_historique_system
    ADD CONSTRAINT id_groupe_foreign_key FOREIGN KEY (id_groupe) REFERENCES cb_groupes(id_groupe);


--
-- TOC entry 1917 (class 2606 OID 17843)
-- Dependencies: 1559 1553 1881
-- Name: id_groupe_foreign_key; Type: FK CONSTRAINT; Schema: public; Owner: baradmin
--

ALTER TABLE ONLY cb_historique_vente
    ADD CONSTRAINT id_groupe_foreign_key FOREIGN KEY (id_groupe) REFERENCES cb_groupes(id_groupe);


--
-- TOC entry 1924 (class 2606 OID 17848)
-- Dependencies: 1561 1565 1889
-- Name: id_perm_foreign_key; Type: FK CONSTRAINT; Schema: public; Owner: baradmin
--

ALTER TABLE ONLY cb_role_perm
    ADD CONSTRAINT id_perm_foreign_key FOREIGN KEY (id_perm) REFERENCES cb_permissions(id_perm);


--
-- TOC entry 1920 (class 2606 OID 17853)
-- Dependencies: 1894 1564 1562
-- Name: id_produit_foreign_key; Type: FK CONSTRAINT; Schema: public; Owner: baradmin
--

ALTER TABLE ONLY cb_prix
    ADD CONSTRAINT id_produit_foreign_key FOREIGN KEY (id_produit) REFERENCES cb_produit(id_produit);


--
-- TOC entry 1925 (class 2606 OID 17858)
-- Dependencies: 1567 1565 1898
-- Name: id_role_foreign_key; Type: FK CONSTRAINT; Schema: public; Owner: baradmin
--

ALTER TABLE ONLY cb_role_perm
    ADD CONSTRAINT id_role_foreign_key FOREIGN KEY (id_role) REFERENCES cb_roles(id_role);


--
-- TOC entry 1927 (class 2606 OID 17863)
-- Dependencies: 1568 1898 1567
-- Name: id_role_foreign_key; Type: FK CONSTRAINT; Schema: public; Owner: baradmin
--

ALTER TABLE ONLY cb_roles_users
    ADD CONSTRAINT id_role_foreign_key FOREIGN KEY (id_role) REFERENCES cb_roles(id_role);


--
-- TOC entry 1923 (class 2606 OID 17868)
-- Dependencies: 1906 1564 1573
-- Name: id_type_foreign_key; Type: FK CONSTRAINT; Schema: public; Owner: baradmin
--

ALTER TABLE ONLY cb_produit
    ADD CONSTRAINT id_type_foreign_key FOREIGN KEY (id_type) REFERENCES cb_type_produit(id_type);


--
-- TOC entry 1921 (class 2606 OID 17873)
-- Dependencies: 1904 1562 1571
-- Name: id_type_prix_foreign_key; Type: FK CONSTRAINT; Schema: public; Owner: baradmin
--

ALTER TABLE ONLY cb_prix
    ADD CONSTRAINT id_type_prix_foreign_key FOREIGN KEY (id_type_prix) REFERENCES cb_type_prix(id_type_prix);


--
-- TOC entry 1914 (class 2606 OID 17878)
-- Dependencies: 1574 1908 1555
-- Name: login_carte_foreign_key; Type: FK CONSTRAINT; Schema: public; Owner: baradmin
--

ALTER TABLE ONLY cb_historique_carte
    ADD CONSTRAINT login_carte_foreign_key FOREIGN KEY (login) REFERENCES cb_users(login);


--
-- TOC entry 1918 (class 2606 OID 17883)
-- Dependencies: 1559 1908 1574
-- Name: login_client_foreign_key; Type: FK CONSTRAINT; Schema: public; Owner: baradmin
--

ALTER TABLE ONLY cb_historique_vente
    ADD CONSTRAINT login_client_foreign_key FOREIGN KEY (login_client) REFERENCES cb_users(login);


--
-- TOC entry 1928 (class 2606 OID 17888)
-- Dependencies: 1568 1574 1908
-- Name: login_foreign_key; Type: FK CONSTRAINT; Schema: public; Owner: baradmin
--

ALTER TABLE ONLY cb_roles_users
    ADD CONSTRAINT login_foreign_key FOREIGN KEY (login) REFERENCES cb_users(login);


--
-- TOC entry 1916 (class 2606 OID 17893)
-- Dependencies: 1908 1557 1574
-- Name: login_foreign_key; Type: FK CONSTRAINT; Schema: public; Owner: baradmin
--

ALTER TABLE ONLY cb_historique_system
    ADD CONSTRAINT login_foreign_key FOREIGN KEY (login) REFERENCES cb_users(login);


--
-- TOC entry 1919 (class 2606 OID 17898)
-- Dependencies: 1908 1559 1574
-- Name: login_vendeur_foreign_key; Type: FK CONSTRAINT; Schema: public; Owner: baradmin
--

ALTER TABLE ONLY cb_historique_vente
    ADD CONSTRAINT login_vendeur_foreign_key FOREIGN KEY (login_vendeur) REFERENCES cb_users(login);


--
-- TOC entry 1949 (class 0 OID 0)
-- Dependencies: 6
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;


-- Completed on 2011-04-05 15:37:48 CEST

--
-- PostgreSQL database dump complete
--

